import {Entity, PrimaryGeneratedColumn, Column, BaseEntity, CreateDateColumn} from "typeorm";

@Entity()
export class Cart extends BaseEntity{
  static findWithImg(arg0: { userid: string; }) {
    return this.query(`select t1.*,t2.imgUrl,t2.descp,t2.price from t_cart t1 left join t_goods t2 on t1.gcode=t2.gcode where t1.userid=?`,[arg0.userid])
  }
    @PrimaryGeneratedColumn()
    id: number;

    @Column({type:"varchar",length:64})
    gcode: string;

    @Column({type:"varchar",length:64})
    userid: string;

    @Column({unsigned:true})
    count:number;
    
    @CreateDateColumn()
    createtime: Date;

}